<template>
  <div>
    <el-row>
      <el-col :span="20" class="pd_20">
        <el-col :span="6" class="clear_btn" v-if="plugin.wxgzhbb && plugin.wxgzhbb.is_open == 1">
          <el-button type="primary" @click="reset_btn('openid','微信绑定')">解除微信绑定</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn" v-if="plugin.wxxcxbb && plugin.wxxcxbb.is_open == 1">
          <el-button type="primary" @click="reset_btn('applets_openid','微信小程序绑定')">解除微信小程序绑定</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn" v-if="plugin.appbbxt && plugin.appbbxt.is_open == 1">
          <el-button type="primary" @click="reset_btn('app_openid','微信app登陆绑定')">解除微信app登陆绑定</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn" v-if="plugin.appbbxt && plugin.appbbxt.is_open == 1">
          <el-button type="primary" @click="reset_btn('zfb_openid','支付宝绑定')">解除支付宝绑定</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn">
          <el-button type="primary" @click="reset_btn('tel','手机号绑定')">解除手机号绑定</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn">
          <el-button type="primary" @click="reset_btn('wx','关联微信')">解除关联微信</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn">
          <el-button type="primary" @click="reset_btn('zfb','关联支付宝')">解除关联支付宝</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn">
          <el-button type="primary" @click="reset_btn('yhk','关联银行卡')">解除关联银行卡</el-button>
        </el-col>
        <el-col :span="6" class="clear_btn">
          <el-button type="primary" @click="reset_btn('smrz','实名认证')">解除实名认证</el-button>
        </el-col>

        <el-col :span="6" class="clear_btn">
          <el-button type="primary" @click="reset_btn('add','用户所在当前地区')">解除用户所在当前地区</el-button>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { mapState } from "vuex";
export default {
  name: "user_reset",
  data() {
    return {};
  },
  components: {},
  props: {
    reset_id: {
      type: [Number, String]
    }
  },
  computed: {
    ...mapState({
      plugin: state => state.plugin
    })
  },
  created() {},
  methods: {
    reset_btn(val, msg) {
      this.$swal({
        title: `如果您确认后，当前会员将会解除${msg}绑定`,
        text: "请谨慎操作！",
        type: "warning",
        showCancelButton: true,
        confirmButtonColor: "#DD6B55",
        confirmButtonText: "确认，我要重置",
        cancelButtonText: "容我三思"
      }).then(willDelete => {
        if (willDelete.value) {
          var params = {};
          params.id = this.reset_id;
          params.types = val;
          this.$api.getUser.userReset(params).then(res => {
            if (res.data.code == 200) {
              this.$swal(`该会员已解除${msg}绑定`, "重置成功！", "success");
              this.$emit("reset_success");
            } else {
              this.$swal("解绑失败！", res.data.result, "success");
            }
          });
        }
      });
    }
  }
};
</script>
<style scoped>
.clear_btn {
  margin-bottom: 10px;
}
</style>
